package cn.evolution.retryutils.service.impl;

import cn.evolution.retryutils.annotations.LocalRetryable;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @author evolution
 * @title: RetryServiceImpl
 * @projectName retry-utils
 * @description: TODO
 * @date 2022-11-17 15:11
 * @ltd：思为
 */
@Service
@Slf4j
public class RetryServiceImpl {
    private int count =0;
    @LocalRetryable(retryQueueName = "retryError",retryOnFixedDelay = 3000)
    public String retryError(){
        if(count < 5 ){
                log.info("retryError -------> error  模拟程序出了异常！");
                count++;
                //故意报错
                int x = 1/0;
        }else{
            log.info("retryError ----success");
            
            return "success";
        }
        return "success";
    }
}
